﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using vite_entity.Entities;

namespace vite_entity.EntityTypeConfig
{
    public class SysDict_TypeConfig : IEntityTypeConfiguration<SysDict>
    {
        public void Configure(EntityTypeBuilder<SysDict> entity)
        {
            entity.HasKey(e => e.Id).HasName("PRIMARY");
            entity
                .ToTable("sys_dict", tb => tb.HasComment("字典类型表"))
                .UseCollation("utf8mb4_general_ci");

            entity.HasIndex(e => e.Code, "uk_code").IsUnique();

            entity.Property(e => e.Id)
                .HasComment("主键 ")
                .HasColumnName("id");
            entity.Property(e => e.Code)
                .HasMaxLength(50)
                .HasDefaultValueSql("''")
                .HasComment("类型编码")
                .HasColumnName("code");
            entity.Property(e => e.CreateTime)
                .HasComment("创建时间")
                .HasColumnType("datetime")
                .HasColumnName("create_time");
            entity.Property(e => e.IsDeleted)
                .HasDefaultValueSql("'0'")
                .HasComment("是否删除(1-删除，0-未删除)")
                .HasColumnName("is_deleted");
            entity.Property(e => e.Name)
                .HasMaxLength(50)
                .HasDefaultValueSql("''")
                .HasComment("类型名称")
                .HasColumnName("name");
            entity.Property(e => e.Remark)
                .HasMaxLength(255)
                .HasComment("备注")
                .HasColumnName("remark");
            entity.Property(e => e.Status)
                .HasDefaultValueSql("'0'")
                .HasComment("状态(0:正常;1:禁用)")
                .HasColumnName("status");
            entity.Property(e => e.UpdateTime)
                .HasComment("更新时间")
                .HasColumnType("datetime")
                .HasColumnName("update_time");
        }
    }
}
